import { useEffect, useState } from 'react'
import './App.css'

function App() {
  //计时
  
  let [count ,setCount]=useState(60)
 
    useEffect(()=>{
      const timer=setInterval(()=>{
      setCount(count--)
      if(count===0){
        clearInterval(timer)
        setCount(60)
        return
      }
  },1000)

  return (()=>{
    clearInterval(timer)
  })
    },[])
    
  
  

  return (
   <div>
    <h3>0天0时0分{count}秒</h3>
   </div>
  )
}

export default App
